﻿/* $RCSFile: IAddonNiceUser.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/ADNCRM.Core/Security/IAddonNiceUser.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:29  christian.surieux
 *   Added Log to All cs files
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Configuration;

using AddonNice.CRMWrapper;

namespace AddonNice.Security
{
    public interface IAddonNiceUser
    {
        /// <summary>
        /// Depending on this mode, ProviderUserKey will contain a real Membership DB key or a Crm Entity(see CrmCustomer for entity type) Key
        /// </summary>
        AuthenticationMode UserAuthentication
        {
            get;
        }
        
        /// <summary>
        /// In Form Authentication-> Membership user Guid when authenticated or Crm SystemUserId from anonymous impersonating Crm user
        /// In Windows Authentication-> Crm SystemUserId from current user
        /// </summary>
        Guid ProviderUserKey
        {
            get;
        }
        
		string CrmCustomerTypeName	
        {
            get;
            set;
        }

        /// <summary>
        /// CRM Customer Guid
        /// </summary>
		Guid CrmCustomerCrmId		
        {
            get;
            set;
        }

        DynEntity CrmCustomerGetDynUser(CRMWrapperBase wrapper,ResetWrapperHandler fn);
        
        Guid CrmImpersonateId
        {
            get;
        }
        
        bool IsAnonymous
        {
            get;
        }
        
        bool IsAdmin
        {
            get;
        }
        
        /// <summary>
        /// Indicate the nature/validity if the ProviderUserKey
        /// </summary>
        bool DummyMembership
        {
            get;
        }
        
        /// <summary>
        /// CRM roles attached to the CRM user attached to the AddonNiceUser (itself or ImpersonateId)
        /// </summary>
        string[] CRMRoles
        {
            get;
        }

        /// <summary>
        /// Depending on authentication 
        /// Form->the impersonate user
        /// AD: wrapper.userid
        /// </summary>
        ADNDynSystemUser GetImpersonateUser(CRMWrapperBase wWrapper);

        ADNDynTransactionCurrency DefaultCurrencyID
        {
            get;
        }

        Guid DefaultCurrencyId
        {
            get;
        }
        
        ADNDynPricelevel DefaultPriceList
        {
            get;
        }

        /// <summary>
        /// Valid if user type is an account or contact, not a Lead or SystemUser 
        /// If no price level, try to take it in the parent customer (only one level)
        /// </summary>
        Guid DefaultPriceListId
        {
            get;
        }
        
        string nickname
        {
            get;
            set;
        }
        
        string UserName
        {
            get;
            set;
        }

        string UserFirstName
        {
            get;
            set;
        }

        
        string Email
        {
            get;
            set;
        }

        int UTCConversionTimezone
        {
            get;
            set;
        }

        string PasswordQuestion
        {
            get;
        }

        bool SendNewsletter
        {
            get;
            set;
        }

        string Company
        {
            get;
            set;
        }

        string Sic
        {
            get;
            set;
        }


        string BillAddress1
        {
            get;
            set;
        }

        string BillAddress2
        {
            get;
            set;
        }

        string BillAddress3
        {
            get;
            set;
        }

        string BillZip
        {
            get;
            set;
        }

        string BillCity
        {
            get;
            set;
        }

        string BillCountry
        {
            get;
            set;
        }

        string BillCountryID
        {
            get;
            set;
        }

        string BillCounty
        {
            get;
            set;
        }

        string BillCountyID
        {
            get;
            set;
        }

        string BillFax
        {
            get;
            set;
        }

        string BillPhone
        {
            get;
            set;
        }

        string ShipAddress1
        {
            get;
            set;
        }

        string ShipAddress2
        {
            get;
            set;
        }

        string ShipAddress3
        {
            get;
            set;
        }

        string ShipZip
        {
            get;
            set;
        }

        string ShipCity
        {
            get;
            set;
        }

        string ShipCountry
        {
            get;
            set;
        }

        string ShipCountryID
        {
            get;
            set;
        }

        string ShipCounty
        {
            get;
            set;
        }

        string ShipCountyID
        {
            get;
            set;
        }

        string ShipFax
        {
            get;
            set;
        }

        string ShipPhone
        {
            get;
            set;
        }

        string Question
        {
            get;
            set;
        }

        string Answer
        {
            get;
            set;
        }

        string NewPwd
        {
            get;
            set;
        }

        bool hasPassword
        {
            get;
        }

        bool hasCompany
        {
            get;
        }
            
        bool CheckPassword(string password);

        void Update();
        string GetCountryID(string CountryName);
        string GetCountyID(string CountryName, string CountyName);
    }
}
